// public 修饰的属性或方法是公有的，可以在任何地方被访问到，默认所有的属性和方法都是 public 的
// private 修饰的属性或方法是私有的，不能在声明它的类的外部访问
// protected 修饰的属性或方法是受保护的，它和 private 类似，区别是它在子类中也是允许被访问的
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        if (typeof b !== "function" && b !== null)
            throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var A1 = /** @class */ (function () {
    function A1(name, age, sex) {
        this.name = name;
        this.age = age;
        this.sex = sex;
    }
    A1.prototype.p = function () {
        console.log(this.name);
    };
    A1.prototype.x = function () {
        console.log('x');
    };
    return A1;
}());
var A2 = /** @class */ (function (_super) {
    __extends(A2, _super);
    function A2() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    A2.prototype.y = function () {
        this.name;
        // this.age //报错
        this.sex; //不报错
        // super.x() //报错
    };
    return A2;
}(A1));
var a1 = new A1('张三', 18, '男');
// a1.age //报错
// a1.sex // 报错
a1.p(); // 不报错
